<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>接口接入管理</title>
	<meta name="decorator" content="default"/>
	<%@ include file="/WEB-INF/views/include/bootstrap-table.jsp"%>
</head>

<body>
	<div class="boxcontent clearfix">
		<div class="content clearfix" style="margin: 0;">
			<form id="searchForm"  class="form-search">
				<div class="search-bar">
		          <ul class="clearfix">
			              <li>
			              <span>登录钥匙：</span>
			              <input id="appKey" name="appKey" class="form-control bootstrap-table-input"/>
						 </li>
			              <li>
			              <span>登录钥匙名称：</span>
			              <input id="appSecret" name="appSecret" class="form-control bootstrap-table-input"/>
						 </li>
						</ul>
					<div id="btn_search" class="search-btn">查询</div>
					<script type="text/javascript">
						$(function(){
							$(".search-bar ul li").each(function(){
								var spanWidth = $(this).find("span").width();
								$(this).find(".form-control").width(230-20-spanWidth);	
								$(this).children(".input-append").find(".required").width(230-20-36+1-spanWidth);	
								var barHeight = $(".search-bar").height();
								$(".search-btn").css("line-height", barHeight+"px");
							});
						})
					</script>
				</div>
				
				<div id="toolbar">
				 <shiro:hasPermission name="sys:appInfo:create">
					<button type="button" class="btn-custom" onclick="createByTitle('sys/appInfo/appInfoForm','新增接口接入管理',false)">新增</button>
				 </shiro:hasPermission>	
				 <shiro:hasPermission name="sys:appInfo:delete">
					<button type="button" class="btn-custom btndelete" onclick="batchDelete('sys/appInfo/batchDelete')">批量删除</button>
				 </shiro:hasPermission>
				</div>
			</form>
			
		<div class="tbbox firsttdCenter">
		
	    <table id="table" 
	         data-toggle="table" 
	         data-url="${ctx}/sys/appInfo/appInfoListJson"
	         data-toolbar="#toolbar"
		     data-height="${dataHeight491}" 
		     data-maintain-selected="true" 
		     data-side-pagination="server"
		     data-click-to-select="true" 
		     data-pagination="true" 
		     data-single-select="false"
		     data-id-field="id"
		     data-query-params="doQuery"
		     data-cache="false"
		     data-show-columns="true"
		     data-page-list="${dataPageList}">
		<thead>
			<tr>
		    	<!-- 属性 data-visible="false" 可以隐藏列 -->
		    	<!-- 属性data-sortable="true" 可以列排序 -->
				<th data-checkbox="true"></th>
				<th data-field="id" data-formatter="operationFormatter" class="date-width-operation">操作</th>
					   <th data-field="appKey">登录钥匙</th>
					   <th data-field="appSecret">登录钥匙名称</th>
					   <th data-field="companyName">所属公司</th>
					   <th data-field="updateDate">更新时间</th>
					   <th data-field="remarks">备注信息</th>
			</tr>
		</thead>
	    </table>
	    </div>
	</div>
	
	<script type="text/javascript">
	  var $table = $('#table');
	  $(function () { 
          
	      $("#btn_search").click(function () { 
	              $table.bootstrapTable('refresh'); 
	       }); 
	   }); 
	  
	  //查询函数
	  function doQuery(params) {
           	 var appKey = $("#appKey").val();
			 if(appKey != null && appKey !=''){
				params.appKey = appKey;
			 }
			 
           	 var appSecret = $("#appSecret").val();
			 if(appSecret != null && appSecret !=''){
				params.appSecret = appSecret;
			 }
			 
		    return params;
	}
	
	/**
	*  操作项  add for lgx  提供查看，修改，删除按钮，如果还有系统按钮，
	*  比如禁用，可在子页面进行自定义函数添加（建议列表操作项按钮不要超过5个）
	*/
	
	var hasView = '${fns:hasPermission("sys:appInfo:view")}';
	var hasEdit = '${fns:hasPermission("sys:appInfo:edit")}';
	var hasDelete = '${fns:hasPermission("sys:appInfo:delete")}';
	
	
	function operationFormatter(value, row){
		
		var params = "id="+value;
		
		var html = '';
		
		if(hasView == 'true'){
			//查看
			html = html + '<a href="javascript:void(0);" style="padding-right:5px;" onclick="detail(\'sys/appInfo/appInfoDetail\',\'查看接口接入管理信息\',\''+params+'\')">查看</a>';
		}else{
			html = html + '<span style="padding-right:5px;" title="您没有操作权限">查看</span>';
		}
	
		if(hasEdit == 'true'){
			//修改
			html = html + '<a href="javascript:void(0);" style="padding-right:5px;" onclick="modify(\'sys/appInfo/appInfoForm\',\'修改接口接入管理信息\',\''+params+'\')">修改</a>';
		}else{
			html = html + '<span style="padding-right:5px;" title="您没有操作权限">修改</span>';
		}

		if(hasDelete == 'true'){
			//删除
			html= html  + '<a href="javascript:void(0);" onclick="deleteData(\'sys/appInfo/deleteAjax\',\'是否删除数据？\',\''+params+'\')">删除</a>';
		}else{
			html = html + '<span style="padding-right:5px;" title="您没有操作权限">删除</span>';
		}
		
		return html;
	}  
	</script>
	
	<jsp:include page="/WEB-INF/views/include/pageJs.jsp" />
</body>

</html>